﻿using System;
using System.Configuration;

namespace Melee.Infrastructure.Configuration
{
    public class WebConfigApplicationSettings : IApplicationSettings
    {
        public string LogConfigFilePath
        {
            get { return AppDomain.CurrentDomain.BaseDirectory + "config/log4net.cfg.xml"; }
        }

        public string NHibernateConfigFilePath
        {
            get { return AppDomain.CurrentDomain.BaseDirectory + "config/hibernate.cfg.xml"; }
        }

        public string LogName
        {
            get { return ConfigurationManager.AppSettings["logger_name"]; }
        }

        public int InterfaceWidth
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["interface_width"]); }
        }

        public int InterfaceHeight
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["interface_height"]); }
        }

        public int AreaLength
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["area_length"]); }
        }

        public int MapXAreaCount
        {
            get { return InterfaceWidth / AreaLength; }
        }

        public int MapYAreaCount
        {
            get { return InterfaceHeight / AreaLength; }
        }

        public int PointLength
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["point_length"]); }
        }

        public int AreaPointCount
        {
            get { return AreaLength / PointLength; }
        }

        public int SessionTimeout
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["session_timeout"]); }
        }

        public int ResetLoginCookieInterval
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["reset_login_cookie_interval"]); }
        }

        public string Welcome
        {
            get { return ConfigurationManager.AppSettings["welcome"]; }
        }

        public int MapWidth
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["map_width"]); }
        }

        public int MapHeight
        {
            get { return Convert.ToInt32(ConfigurationManager.AppSettings["map_height"]); }
        }

        public string ImageBaseDir
        {
            get { return ConfigurationManager.AppSettings["image_base_dir"]; }
        }

        public string ImageFileNames
        {
            get { return ConfigurationManager.AppSettings["image_file_names"]; }
        }

        public string ImageExtensions
        {
            get { return ConfigurationManager.AppSettings["image_extensions"]; }
        }
    }
}
